export default{
    namespaced:true,
    state:{
        head: {},
        banner: {},
        changguan: {},
        dazhe: {},
        leimu: {}
    },
    mutations:{
        changeData(state,payload){
            state.head = payload.head;
            state.banner = payload.banner;
            state.changguan = payload.changguan;
            state.dazhe = payload.dazhe;
            state.leimu = payload.leimu;

        }

    },
    actions:{
        getData(context,payload){
            axios
            .all([
              // 写请求路径
              axios.get("/headerZ/"+payload),
              axios.get("/bannerZ/"+payload),
              axios.get("/changguanZ/"+payload),
              axios.get("/dazheZ/"+payload),
              axios.get("/leimuZ/"+payload),
            ])
            .then(
              axios.spread((
                // 写请求返回的参数名名字
                head,
                banner,
                changguan,
                dazhe,
                leimu,
              )=> {
                // 写返回值的处理
                context.commit({
                    type:"changeData",
                    count:{
                        head:head.data.count,
                        banner:banner.data.count,
                        changguan:changguan.data.count,
                        dazhe:dazhe.data.count,
                        leimu:leimu.data.count,
                    }
                })
      
              })
            );

        }

    }
}
// 继续传